<template>
  <div>
    <top-nav from="true" title="产品列表" html="帮助"></top-nav>
    <div class="bidList">
      <div class="bids" id="bids">
        <!--循环-->
        <router-link :to="'/product/dtl/'+item.borrowEid" v-for="item in borrowList" :key="item.borrowEid">
          <div class="bid">
            <div>{{ item.borrowTitle }}</div>
            <div>
              <div>
                <div>
                  <div class="red tl font18">{{ item.rate }}%</div>
                  <div class="tc">{{ item.borrowTimeLimit }}</div>
                  <div class="tc">{{ item.borrowSum }}</div>
                </div>
                <div class="color-bars">
                  <div class="red-bar" :style="'width:'+item.process+'%'"></div>
                </div>
              </div>
              <div>
                <a href=""
                   class="bg-red">抢购</a>
              </div>
            </div>
          </div>
        </router-link>
        <loadmore :fn="loadFn" :type="loadType"></loadmore>
      </div>
    </div>
  </div>
</template>

<script>
  import { base, api, open } from '@/common/constant'
  import TopNav from '@/components/TopNav'
  import Loadmore from '@/components/Loadmore'

  export default {
    name: 'product-list',
    data () {
      return {
        page: {},
        borrowList: [],
        loadType: 1,
        loadFn: 'getProductListData'
      }
    },
    mounted (){
      this.$nextTick(function () {
        this.getData()
      })
    },
    //computed: mapState(['bannerList']),
    methods: {
      getData: function () {
        console.log('产品列表类型', this.$route.params.type)
        this.$store.dispatch('post', {
          url: api.borrowList,
          params: {borrowType: this.$route.params.type},
          ok: open.borrowList,
          fail: base.emptyList,
          that: this
        })
      }

    },
    components: {
      TopNav, Loadmore
    }
  }
</script>
